package com.zjht.gmcc.servlet.sys;

import java.io.PrintWriter;
import java.sql.PreparedStatement;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zjht.gmcc.bean.BaseServlet;
import com.zjht.gmcc.bean.util.MyJDBC;


public class Zhsx extends BaseServlet {

	private static final long serialVersionUID = 1L;


	public boolean process(HttpServletRequest request, HttpServletResponse response,HttpSession session, PrintWriter out, MyJDBC myJDBC,  String menu)throws Exception {
		response.setContentType("text/xml;charset=UTF-8");
		response.setHeader("Cache-Control", "no-cache");
		String s_opercode = request.getParameter("opercode").trim();
		StringBuilder sb = new StringBuilder("<state>");

		int i_flag = 0;
		String s_sql = null;
		PreparedStatement ps = null;
		s_sql = "update opers set opertype=?,status=? where opercode=?";
		ps = myJDBC.prepareStatement(s_sql);
		ps.setString(1, "1");
		ps.setString(2, "1");
		ps.setString(3, s_opercode);
		i_flag = ps.executeUpdate();
		s_sql = null;
		ps.close();
		ps = null;

		if (i_flag == 1)
			sb.append("<value>0</value>");
		else {
			sb.append("<value>1</value>");
		}

		sb.append("</state>");
		out.write(sb.toString());

		return true;
	}
}
